﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using WXYW.Entities;
using WXYW.DAL;
using WXYW.BLL;

namespace WXYW
{
    public partial class ChangePassword : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void OKBtn_Click(object sender, EventArgs e)
        {
            try
            {
                UserService userService = new UserService();
                User user = userService.GetUserByID(ContextService.CurrentAccount.UserID);
                user.UserPassword = newPasswordTxtBox.Text;
                userService.UpdateUser(user);
                MsgLbl.Text = "密码修改成功，请关闭当前页面，重新登录。";
            }
            catch (Exception ex)
            {
                LogUtility.LogUtilityIntance.LogException(ex, "ChangePassword.aspx.cs -> OKBtn_Click");
                MsgLbl.Text = string.Format("系统错误:{0}", ex.Message);
            }
        }
    }
}
